package com.ale.oxetool.model;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by guoshunw on 2015/11/3.
 */
public class Phone {
    private String name;
    private String mac;
    private String ipVer="";
    private String ipAddr;
    private String type;
    private String number;

    private String oxeServerAddr;

    private boolean OXE1 = true;

    private Map<String, Object> dynamicProperties = new HashMap<>();

    public Map<String, Object> getDynamicProperties() {
        return dynamicProperties;
    }

    public void setDynamicProperties(Map<String, Object> dynamicProperties) {
        this.dynamicProperties = dynamicProperties;
    }

    public boolean isOXE1() {
        return OXE1;
    }

    public void setOXE1(boolean OXE1) {
        this.OXE1 = OXE1;
    }

    public boolean isOXE2() {
        return !OXE1;
    }

    public void setOXE2(boolean isOXE2) {
        this.OXE1 = !isOXE2;
    }

    public Phone(String name, String mac, String ipAddr, String type, String number) {
        this.name = name;
        this.mac = mac;
        this.ipAddr = ipAddr;

        this.type = type;
        this.number = number;
    }

    public Phone(String name, String mac, String ipAddr, String type, String number, String oxeServerAddr) {
        this(name, mac, ipAddr, type, number);
        this.oxeServerAddr = oxeServerAddr;
    }

    public Phone(String name, String mac, String ipAddr, String type, String number, String oxeServerAddr, boolean isOXE1) {
        this(name, mac, ipAddr, type, number, oxeServerAddr);
        this.OXE1 = isOXE1;
    }

    public String getIdProp(){
        return ipAddr;
    }
    public String getNumber() {
        return number;
    }

    public Phone setNumber(String number) {
        this.number = number;
        return this;
    }

    public String getIpAddr() {
        return ipAddr;
    }

    public Phone setIpAddr(String ipAddr) {
        this.ipAddr = ipAddr;
        return this;
    }

    public String getName() {
        return name;
    }

    public Phone setName(String name) {
        this.name = name;
        return this;
    }

    public String getMac() {
        return mac;
    }

    public Phone setMac(String mac) {
        this.mac = mac;
        return this;
    }

    public String getIpVer() {
        return ipVer;
    }

    public Phone setIpVer(String ipVer) {
        this.ipVer = ipVer;
        return this;
    }

    public String getType() {
        return type;
    }

    public Phone setType(String type) {
        this.type = type;
        return this;
    }

    public String getOxeServerAddr() {
        return oxeServerAddr;
    }

    public Phone setOxeServerAddr(String oxeServerAddr) {
        this.oxeServerAddr = oxeServerAddr;
        return this;
    }


    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Phone phone = (Phone) o;

        return mac != null ? mac.equals(phone.mac) : phone.mac == null;

    }

    @Override
    public int hashCode() {
        return mac != null ? mac.hashCode() : 0;
    }

    @Override
    public String toString() {
        return "Phone{" +
                "name='" + name + '\'' +
                ", mac='" + mac + '\'' +
                ", ipVer='" + ipVer + '\'' +
                ", ipAddr='" + ipAddr + '\'' +
                ", type='" + type + '\'' +
                ", number='" + number + '\'' +
                ", oxeServerAddr='" + oxeServerAddr + '\'' +
                ", isOXE1=" + OXE1 +
                '}';
    }
}
